package Market;

import java.util.ArrayList;
import sim.engine.*;


public class Market extends SimState
{
	private static final long serialVersionUID = 6628525522939315274L;
	
// GenCo part												
												/** number of GenCos */
	  private int I=3;	  
	  private double[][] GenCoData;
	  private ArrayList GenCoList;
	  private ElGrid elgrid;
	  
// LSE part
												/** number of LSEs */
	  private int J=3;      
	  private double[][] LSEData;
	  private ArrayList LSEList;

	  
//-------Constructor----------------------------------------------
    public Market(long seed)
        {
        super(seed);
        }
//-----------------------------------------------------------------
    
    public void start()
        {
        super.start();
        
        OptimalPowerFlow opf = new OptimalPowerFlow();
        
/*
        elgrid = new ElGrid();
        	
//----- GenCo--------------------------------------------------------               	
        	GenCoList = new ArrayList();
        	GenCoData = new double[I][8];
       
        	Initials.InitGenCo initG = new Initials.InitGenCo(I);
        	GenCoData = initG.getGenCoData();
           
        	for(int i=0; i<I; i++){                        
        		GenCo gen = new GenCo(GenCoData, i);        	
        		schedule.scheduleRepeating(gen);        	       	
        		elgrid.addGenCoAtNodeK(gen,(i+1));            
        		GenCoList.add(gen);
        	}             	
//----- LSE-------------------------------------------------------- 
        
        	LSEList = new ArrayList();
        	LSEData = new double[J][26];
        	
        	Initials.InitLSE initL = new Initials.InitLSE(J);
        	LSEData = initL.getLSEData();
        	
        	for(int j=0; j<J; j++){                        
        		LSE lse = new LSE(LSEData, j);        	        		
        		schedule.scheduleRepeating(lse);        	       	
        		elgrid.addLSEAtNodeK(lse,(j+1));            
        		LSEList.add(lse);
        	}     	
        	
       //schedule.scheduleRepeating(new GenCo()); // temp
       // schedule.scheduleRepeating(new ISO()); //  temp
*/
        }

//-------Main-----------------------------------------------------
    public static void main(String[] args)
        {
        Market market = new Market(System.currentTimeMillis());
        market.start();
        long steps = 0;
        //while(steps < 5000)
        
        for(int i=0; i<1; i++) {

        	market.schedule.step(market);
            steps = market.schedule.getSteps();

           // System.out.println("Steps: " + steps );
            
            }
        
        //OptimalPowerFlow opf = new OptimalPowerFlow();
        System.out.println("Done!!!");
        market.finish();
        System.exit(0);
        }
    }
